package org.rosildos.ricotta;

import static org.junit.Assert.*;

import org.apache.log4j.Logger;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.junit.Test;
import org.rosildos.ricotta.model.User;

public class HibernateUserPseudoDao extends AbstractHibernateTestCase {
	
	public static Logger logger = Logger.getLogger(HibernateUserPseudoDao.class);
	
	
	@Test
	public void testCreateUser() {
		Transaction tx = session.beginTransaction();
		try {
			User user = new User();
			user.setEmail("foo01@foo.com");
			user.setUsername("foo01");
			user.setPassword("123");
			session.save(user);		
			tx.commit();
			logger.info("user create| " + user);
		} catch (Exception e) {
			logger.warn("Exception catched| " + e.getMessage(), e);
			if (tx != null) tx.rollback();
		}
	}

}
